package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ReprotService;
import com.sky.service.WorkspaceService;
import com.sky.vo.BusinessDataVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.OrderOverViewVO;
import com.sky.vo.SetmealOverViewVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.LocalTime;

@RestController
@RequestMapping("/admin/workspace")
@Api(tags = "工作台相关接口")
@Slf4j
public class workspaceController {
    @Autowired
    private WorkspaceService workspaceService;
    @Autowired
    private ReprotService reportService;

    /**
     * 今日数据
     * @return
     */
    @GetMapping("/businessData")
    public Result<BusinessDataVO> businessDate(){
        LocalDateTime begin = LocalDateTime.now().with(LocalTime.MIN);
        //获得当天的结束时间
        LocalDateTime end = LocalDateTime.now().with(LocalTime.MAX);
        return Result.success(workspaceService.businessDate(begin,end));
    }

    /**
     * 工作台订单管理
     * @return
     */
    @GetMapping("/overviewOrders")
    public Result<OrderOverViewVO> overviewOrders(){
        return Result.success(workspaceService.overviewVoOrders());
    }

    /**
     * 菜品管理
     * @return
     */
    @GetMapping("overviewDishes")
    public Result<DishOverViewVO> overviewDish(){
        return Result.success(workspaceService.overviewDish());
    }
    /**
     * 套餐管理
     * @return
     */
    @GetMapping("overviewSetmeals")
    public Result<SetmealOverViewVO> overviewSetmeals(){
        return Result.success(workspaceService.overviewSetmeals());
    }

}
